package com.zhiyou100.loans.dao.impl;

import java.sql.ResultSet;

import com.zhiyou100.loans.dao.LendbillDao;
import com.zhiyou100.loans.model.Lendbill;
import com.zhiyou100.loans.util.JDBCUtil;

public class LendbillDaoImpl implements LendbillDao {
	JDBCUtil util = new JDBCUtil();
	@Override
	public int add(Lendbill lendbill) {
		String sql = "insert into lendbill(loanbillid,money,lenderid,lendtime) values(?,?,?,?)";
		Object[] objs={lendbill.getLoanbillid(),lendbill.getMoney(),lendbill.getLenderid(),lendbill.getLendtime()};
		return util.update(sql, objs);
	}
	@Override
	public ResultSet selectTotalLendmoney(int parseInt) {
		String sql = "select sum(money) money from lendbill where lenderid=?";
		Object[] objs={parseInt};
		return util.query(sql, objs);
	}

}
